﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace Drug_Management_System
{
    public partial class Frm_AddUsers : Form
    {
        SqlDataAdapter sda;
        
        SqlCommandBuilder scb;

        DataTable dt;


        public Frm_AddUsers()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            
        }

        private void Frm_AddUsers_Load(object sender, EventArgs e)
        {
            sda = new SqlDataAdapter("select * from sys_user", connection.strConn);
            scb = new SqlCommandBuilder(sda);
            dt = new DataTable("users");
            try
            {
                sda.Fill(dt);

                dt.PrimaryKey = new DataColumn[] { dt.Columns[0] };
                dataGridView1.DataSource = dt;
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.ToString());
            }

        }
    }
}